package view;

import service.AdminService;
import service.StudentManagerService;

import java.util.Scanner;

//控制台界面
public class ConsoleView {
    StudentManagerService studentManagerService = new StudentManagerService();
    //登录界面
    public void loginView(){
        //用来保存键盘输入的
        String adminUsername;
        String adminPassword;
        Boolean isLogin = false;
        while(!isLogin){
            AdminService adminService = new AdminService();
            Scanner scanner = new Scanner(System.in);
            System.out.println("管理员账号：");
            adminUsername = scanner.nextLine();
            System.out.println("管理员密码：");
            adminPassword = scanner.nextLine();
            isLogin = adminService.login(adminUsername, adminPassword);
            if (isLogin) {
                System.out.println("登录成功");
                break;
            }else{
                System.out.println("登陆失败");
                System.out.println("请重新登录！");

            }
        }
        menuView();
    }
    //操作菜单界面
    public void menuView(){
        System.out.println("==========");
        System.out.println("1.新增学生");
        System.out.println("2.删除学生");
        System.out.println("3.查找学生");
        System.out.println("4.修改学生");
        System.out.println("5.退出系统");
        System.out.println("==========");
        int num = studentManagerService.selectMenuNum();
        System.out.println("用户选择了："+num);
    }
}